#pragma once
#ifndef _KH_CORE_CONVERTERS_H
#define _KH_CORE_CONVERTERS_H
#include <Kharlia/Core/Common.h>

#define KH_GET_STORAGE(TYPE) void* storage = \
    (reinterpret_cast<converter::rvalue_from_python_storage<TYPE>*>(data)->storage.bytes)

#define KH_SET_STORAGE data->convertible = storage;

#define KH_INIT_TO_CONVERTER(TYPE) to_python_converter<TYPE, TYPE##_To>()

#define KH_INIT_FROM_CONVERTER(TYPE) \
    converter::registry::push_back(&##TYPE##_From::convertible, \
                                       &##TYPE##_From::construct, \
                                        type_id<TYPE>())

#define KH_INIT_CONVERTER(TYPE) \
    to_python_converter<TYPE, TYPE##_To>(); \
    converter::registry::push_back(&##TYPE##_From::convertible, \
                                       &##TYPE##_From::construct, \
                                        type_id<TYPE>())

namespace kharlia { namespace core {

void _InitConverters();

}}

#endif